﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Capa_Datos;
using Capa_Negocio;

namespace TestSplashScreen.Familia
{
    public partial class frmSeleccionarFamilia : Form
    {
        public frmSeleccionarFamilia()
        {
            InitializeComponent();
        }

        private void btnFinalizar_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void btnAlta_Click(object sender, EventArgs e)
        {
            frmAltaFamilia frm = new frmAltaFamilia();
            frm.MdiParent = fMain.ActiveForm;
            frm.Show();
        }

        private void btnFiltrar_Click(object sender, EventArgs e)
        {
            familia f = new familia();
            familiaCN fm = new familiaCN();
            if (txtIdFamilia.Text == "")
                txtIdFamilia.Text = "0";
            f.Id_familia = Convert.ToInt16(txtIdFamilia.Text);
            f.Nombre = txtNombre.Text;
            gridFamilias.DataSource = fm.General(f);
        }

        private void gridFamilias_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (gridFamilias.SelectedRows.Count != 0)
            {
                int IdUsuario = Convert.ToInt16(gridFamilias.SelectedRows[0].Cells[1].Value);
                frmModiBajaFamilia oFrm = new frmModiBajaFamilia(IdUsuario);
                oFrm.ShowDialog();
            }
            else
                MessageBox.Show("No esta seleccionado un Usuario");
        }
    }
}
